package homework.homework_6;

/**
 * @author 朱
 * @date 2019032820:16
 */
public class Appear {
    public static void main(String[] args) {
        String maxString="woaijavawozhenaijavawozhendeaijavawozhendehenaijava";
        String minString="java";
        int count=getcount(maxString,minString);
        System.out.println("java在大串中出现的次数"+count);

    }

    private static int getcount(String maxString, String minString) {
        int count=0;
        int index;
        while ((index=maxString.indexOf(minString))!=-1){
            count++;
            maxString = maxString.substring(index + minString.length());
        }
        return count;
    }
}
